<template>
  <h2>setup 细节</h2>
  <div>父级组件</div>
  <p>{{msg}}</p>
  <hr/>
  <Child :msg="msg" :msg2="'我是msg2'" @changeV="changeVa"/>

  <button @click="changeMsg">改变数据</button>
</template>
<script lang="ts">
import {defineComponent, ref} from "vue";
import Child from "./components/child.vue";

export default defineComponent({
  name: "App",
  setup() {
    console.log("setup");
    const msg = ref('msg数据')
    const changeMsg = () => {
      msg.value = '改变了'
    }
    const changeVa = (v: string)=>{
      msg.value = v
    }
    return {
      msg,
      changeMsg,
      changeVa
    }
  },
  components: {
    Child,
  },
});
</script>
